package com.yuan.statemachine.business.order;

import com.yuan.statemachine.business.BusinessEventEnum;
import com.yuan.statemachine.business.BusinessFunctionEnum;
import com.yuan.statemachine.business.BusinessStateMachine;
import com.yuan.statemachine.business.MessageBody;
import com.yuan.statemachine.core.StateMachine;
import org.springframework.stereotype.Service;

import static com.yuan.statemachine.business.BusinessFunctionEnum.ORDER;

/**
 * @author wjwei
 */
@Service
public class WaitPayOrderService extends BusinessStateMachine<BusinessFunctionEnum, OrderStatusEnum, BusinessEventEnum> {

    @Override
    public MessageBody pay(Object data) {
        return MessageBody.success(data);
    }

    @Override
    public MessageBody intercept(Object data) {
        return MessageBody.success(data);
    }

    @Override
    public MessageBody invalid(Object data) {
        return MessageBody.success(data);
    }

    @Override
    public void registrar(StateMachine<BusinessFunctionEnum, OrderStatusEnum, BusinessEventEnum> stateMachine) {
        stateMachine.register(this, OrderStatusEnum.WAIT_PAY, ORDER);
    }
}
